Conversation
BWT/BWT/Program.cs
Outdated
| @@ -1,208 +0,0 @@ | |||
| namespace Sort; | |||
There was a problem hiding this comment.
Этот коммит удалит домашку с BWT. Если это и был план, то это всё равно незачем делать в этом пуллреквесте, удалите отдельно.
There was a problem hiding this comment.
Напоминаю. Может, Вам за неё стыдно, но не всё так плохо ведь :)
| @@ -0,0 +1,259 @@ | |||
| namespace Sort; | |||
There was a problem hiding this comment.
Корневое пространство имён проекта по традиции называется так же, как сам проект, а раз так, то и сам проект (и решение) называется в PascalCase.
|
|
||
| using System; | ||
|
|
||
| interface OperationsWithElementsStruct |
There was a problem hiding this comment.
В C# есть правило "одна сущность — один файл", так что этот интерфейс с очень странным называнием надо вынести в отдельный файл, переименовать и написать к нему комментарий.
|
|
||
| interface OperationsWithElementsStruct | ||
| { | ||
| // Add element to struct |
There was a problem hiding this comment.
struct — это другое, Вы не понимаете :) В условии речь шла про стек
| bool IsEmpty(); | ||
| } | ||
|
|
||
| public class StackWithArray : OperationsWithElementsStruct |
There was a problem hiding this comment.
И к самому классу нужен комментарий
| int multiplier = 10; | ||
| int number = 0; | ||
| while (i < stringWithExpression.Length && stringWithExpression[i] >= '0' && stringWithExpression[i] <= '9') | ||
| { | ||
| number += stringWithExpression[i] - '0'; | ||
| number *= multiplier; | ||
| ++i; | ||
| } | ||
| number /= 10; | ||
| --i; | ||
| if (isNeedMinus) | ||
| { | ||
| number *= -1; | ||
| } |
There was a problem hiding this comment.
Погуглите string.Split() и int.TryParse :)
| { | ||
| double numberAfter = 0; | ||
| (var isCorrect, var firstNumber) = stackExpression.RemoveElement(); | ||
| (isCorrect, var secondNumber) = stackExpression.RemoveElement(); |
| { | ||
| return (false, 0); | ||
| } | ||
| return true == stackExpression.IsEmpty() ? (true, result) : (false, 0); |
|
|
||
| class Program | ||
| { | ||
| public static void Main(string[] args) |
There was a problem hiding this comment.
Используйте top-level statements
| // Receives the input string in which the expression is written in postfix form, finds the result | ||
| public (bool, double) ConvertToAResponse(string stringWithExpression) | ||
| { | ||
| StackList stackExpression = new StackList(); |
There was a problem hiding this comment.
Стековый калькулятор должен знать только про интерфейс стека (то есть вообще в коде класса «Стековый калькулятор» не должно быть ни одного упоминания конкретных реализаций стека, даже если очень хочется).
Это невыполнение требований условия.
…ь они идут отдельно с маленькой, при этом в каталоге отображаются с большой, а при добавлении с большой git status их не выделяет, поэтому этот комит их отдельное добавление
Другая ветка
BWT/BWT/Program.cs
Outdated
| @@ -1,208 +0,0 @@ | |||
| namespace Sort; | |||
There was a problem hiding this comment.
Напоминаю. Может, Вам за неё стыдно, но не всё так плохо ведь :)
| @@ -0,0 +1,16 @@ | |||
| namespace StackCalculator; | |||
|
|
|||
| interface IOperationsWithStack | |||
There was a problem hiding this comment.
Лишний пробел перед interface и фигурной скобкой ниже
There was a problem hiding this comment.
И нужен комментарий к самому интерфейсу
|
|
||
| class Program | ||
| { | ||
| public static void Main(string[] args) |
| using System; | ||
| class Program |
| { | ||
| public static void Main(string[] args) | ||
| { | ||
| Test test = new Test(); |
|
|
||
| public class StackCalculator | ||
| { | ||
| private double delta = 0.0000000000001; |
There was a problem hiding this comment.
| private double delta = 0.0000000000001; | |
| private const double delta = 0.0000000000001; |
| // Receives the input string in which the expression is written in postfix form, finds the result | ||
| public (bool, double) ConvertToAResponse(string stringWithExpression) | ||
| { | ||
| Stack stackExpression = new(); |
There was a problem hiding this comment.
Stack — это конкретный класс, так что требования условия всё ещё не выполняются. Хорошая попытка, но должно быть наоборот, ArrayStack наследует от интерфейса Stack
| string[] expressionArray = stringWithExpression.Split(' '); | ||
| while (i < expressionArray.Length) | ||
| { | ||
| var isCorrectNumber = Int32.TryParse(expressionArray[i], out var number); |
There was a problem hiding this comment.
| var isCorrectNumber = Int32.TryParse(expressionArray[i], out var number); | |
| var isCorrectNumber = Int32.TryParse(expressionArray[i], out var number); |
| public double valueStack { get; set; } | ||
| public StackElement next { get; set; } |
There was a problem hiding this comment.
Всё, что public, в C# пишется с заглавной
| // Tests the program | ||
| public bool TestForProgram() | ||
| { | ||
| StackCalculator calculator = new StackCalculator(); |
There was a problem hiding this comment.
| StackCalculator calculator = new StackCalculator(); | |
| var calculator = new StackCalculator(); |
yurii-litvinov
left a comment
There was a problem hiding this comment.
Не-а, это всё равно удалит BWT, попробуйте ещё раз
Постфиксный калькулятор